package com.zbl.zblproject.core.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zbl.zblproject.core.entity.Brand;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;


/**
 * @author youlanqiang
 * @version 1.0
 * @date 2018/10/9
 */
@Repository
public interface BrandMapper extends BaseMapper<Brand> {

    /**
     * 根据品牌名称查询供应商是否为直供
     * @param name
     * @return
     */
    Integer selectCentralizedPurchasing(String name);

    @Select(" SELECT brand_id FROM zbl_brand WHERE brand_name = #{name} ")
    Integer selectIdByBrandName(@Param("name") String name);

    /**
     * 根据商品的ID查询出品牌名称
     * @param goodsId 商品ID
     * @return 品牌名称
     */
    String selectBrandNameByGoodsId(@Param("id") Integer goodsId);

    @Select("SELECT * FROM zbl_brand WHERE brand_name = #{name} ")
    Brand selectBrandByBrandName(@Param("name") String name);

}
